<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    #div1, #div2 {
      width:100px;
      height:50px;
      padding:10px;
      border:1px solid #aaaaaa;
    }
  </style>
</head>
<body>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)">
  <span id="drag" draggable="true" ondragstart="drag(event)">drag me to the other box</span>
</div>
<div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
</body>
<script>

async function throwError() {
  throw new Error('xxxxxxxxxxx')
}

async function testError() {
  try {
    const aaa = await throwError()
  } catch (error) {
    throw error
  }
}

async function __test() {
  testError().then(res => {
    console.log(res)
  }).catch((error) => {
    console.error(error)
  })
}

function test () {
  __test().catch(error => {
    console.log('error: => ', error)
  })
}

test ();

/*const item = [1, 2, 3, 4].some((value, index, array) => {
  console.log(value, index, array);
  return value > 2
});

  console.log(item);*/

function func1(arg, next1, next2) {
  console.log(1, arg, next1, next2);
  next2()
}
function func2(arg, next) {
  next(9999)
}
function func3(arg, next) {
  next()
}
function func4(arg, next) {
  console.log(next)
}

/*function combine (...arg) {
  return arg.reduce((prev, next) => {
    return (...args) => {
      console.log(args);
      const __next = args.pop();
      return prev(...args, () => next(...args, __next))
    }
  })
}*/

function combine (...arg) {
  return arg.reduce((prev, next) => {
    return (args, cb, __next) => prev(args, cb, () => next(args, cb, __next))
  })
}

const member = combine(func1, func2, func3, func4);

// console.log('member: => ', member);
member('xxxxxxxxxxxxxxxxxxxx', (data) => {
  console.log('member: => ', data);
})
</script>


(((() => {}) => {}) => {}) => {}
</html>
